build: Add support for linking with DT_RELR
authorHauke Mehrtens <[email protected]>
Thu, 6 Nov 2025 22:08:04 +0000 (23:08 +0100)
committerHauke Mehrtens <[email protected]>
Tue, 18 Nov 2025 22:17:09 +0000 (23:17 +0100)
commita2a78c04f807806d81dde1d146d3688707a375de
treec67fe683c712817dfca3592313b5edec8d11bc50
parent08997df4753470811829ea09eec7a5c3366aac63
build: Add support for linking with DT_RELR

This adds the -Wl,-z,pack-relative-relocs linking options.
This reduces the size of some binaries.

This is only supported on i386, x86_64, aarch64 and loongarch64 in
binutils. This feature is not support for MIPS.

musl libc supports it since version 1.2.4 .
glibc supports it since vesion 2.36.
binutils ld supports it since version 2.38 for x86 and since version
2.43 for LoongArch.

This reduces the size of the armsr default root file system from
5,262,198 bytes to 5,200,950 bytes by 61,248 bytes.

Link: https://github.com/openwrt/openwrt/pull/20679
Signed-off-by: Hauke Mehrtens <[email protected]>
config/Config-build.in
include/hardening.mk